lib/repo-pull: Fix counting of latest commits when finding repos
authorPhilip Withnall <withnall@endlessm.com>
Mon, 7 Aug 2017 12:37:57 +0000 (13:37 +0100)
committerAtomic Bot <atomic-devel@projectatomic.io>
Tue, 8 Aug 2017 13:59:58 +0000 (13:59 +0000)
commitbe4832242da27887399eb0c0bb7be1378d858b14
treefc0ac5f0360d37b9c82e8d65312c12122d6c9c53
parent39b3c8e90a7ba0195cd2d4b8bef2f776a9b45c9b
lib/repo-pull: Fix counting of latest commits when finding repos

The intended behaviour of ostree_repo_find_remotes() is to return
results which have the latest version of at least one of the requested
refs. Results which have some of the requested refs, but don’t have the
latest version of any of them, should be ignored. The logic to do this
was broken in the case that a result contained a positive number of the
requested refs, but none of them were the latest version. (It previously
worked when the result contained none of the requested refs.)

Fix the counting to work correctly in both cases.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #1058
Approved by: cgwalters
src/libostree/ostree-repo-pull.c
tests/test-find-remotes.sh